home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / MEML.ASM < prev    next >
Assembly Source File  |  1988-12-18  |  1KB  |  54 lines

  1. Comment *
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │meml.asm                                     │
  4. │Look at a long of memory, pass it back to c as the function result.         │
  5. │                                         │
  6. │Synopsis: w = meml(0x40,0x17);                          │
  7. └────────────────────────────────────────────────────────────────────────────┘
  8. *
  9.  
  10. ;=============================================================================
  11. ;                    Data
  12. ;=============================================================================
  13.  
  14. DGROUP    group    _DATA
  15. _DATA    segment word public 'DATA'
  16.     assume    ds:DGROUP
  17.  
  18.     ; Your Data goes here . . .
  19.  
  20. _DATA    ends
  21.  
  22. ;=============================================================================
  23. ;                   Code
  24. ;=============================================================================
  25.  
  26.     assume cs:_text
  27. _text    segment public byte 'code'
  28.     PUBLIC _meml
  29.  
  30. _meml        proc near
  31.  
  32.     push bp             ; save base of stack
  33.     mov bp,sp            ; establish stack frame
  34.  
  35.     push ds             ; save data and extra segs
  36.     push si
  37.  
  38.     push [bp+4]            ; get segment address
  39.     pop ds
  40.     mov si,[bp+6]            ; get offset address
  41.     mov ax,[si]            ; get byte in return parameter
  42.     mov bx,[si+2]
  43.  
  44.     pop si
  45.     pop ds                ; restore data and extra segs
  46.  
  47.     mov sp,bp            ; restore stack pointer
  48.     pop  bp             ; and base of stack
  49.     ret                ; return to caller
  50.  
  51. _meml        endp
  52. _text    ends
  53. end
  54.